package oj;

public class LC198 {
    public int rob(int[] nums) {
        int dp1=0;
        int dp2=0;
        int dp=0;
        int n=nums.length;
        for(int i=n-1;i>=0;i--){
            dp=Math.max(dp1,nums[i]+dp2);
            dp2=dp1;
            dp1=dp;
        }
        return dp;
    }
}
